
use "/Users/.../FragmentationState.dta", clear
******FIGURE 3 Conflict summary (STATE LEVEL DATA)
*******collapse papal conflicts to create average levels by century by state
preserve
drop if year <=1100 
drop if year>=1750
collapse  DO_dummy_all150_share conflicts_RA_forward_papal, by (year)
graph twoway (line  conflicts_RA_forward_papal DO_dummy_all150_share year), graphregion (color(white)) legend(label(1 "Papal conflict") label(2 "Secular conflict")) ytitle("Average conflict by state") 
restore
****in graph editor, specify max min 1100 1800 delta 100
graph save Graph "/Users/a.../Figure3conflictsummary.gph", replace


use "/Users/a.../FragmentationRaster.dta", clear 

***footnote 24: overlap with Dincecco and Onorato?
pwcorr conflicts_RA_forward_papal DOdummyall150N, sig star (5)
*********.025, sig .05

******TABLES 1 and 2, Figure 4
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN HRE protestant, a(ID year) vce(cluster ID)
estimates store f0
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE protestant, a(ID year) vce(cluster ID)
estimates store f01
coefplot f01, drop (_cons HRE protestant) xline (0) order (conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN VBBCommuneN KS_primogeniture)  graphregion(fcolor(white)) 
graph save Graph "/Users/.../Figure4fragmentation.gph", replace

preserve
drop if year>=1400
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N, a(ID year) vce(cluster ID)
estimates store f1
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN HRE, a(ID year) vce(cluster ID)
estimates store f2
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN VBBCommuneN HRE, a(ID year) vce(cluster ID)
estimates store f3
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE, a(ID year) vce(cluster ID)
estimates store f4
restore

preserve
drop if year<=1450
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N, a(ID year) vce(cluster ID)
estimates store f5
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N HRE protestant, a(ID year) vce(cluster ID)
estimates store f6
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN HRE, a(ID year) vce(cluster ID)
estimates store f7
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN HRE protestant , a(ID year) vce(cluster ID)
estimates store f8
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE, a(ID year) vce(cluster ID)
estimates store f9
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE protestant, a(ID year) vce(cluster ID)
estimates store f10
restore

esttab f0 f1 f2 f5 f7 f8 using Table1.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation\label{tab1a}) 

esttab f01 f4 f9 f10 using Table2.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f)) noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation in the Presence of Potential Religious Confounders\label{tab1a})

*esttab f0 f1 f2 f5 f7 f8 using Table1.rtf, replace se cells(b(star fmt(%9.2f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f)) noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation) 

*esttab f01 f4 f9 f10 using Table2.rtf, replace se cells(b(star fmt(%9.2f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f)) noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation) 

******OSter sensitivity tests: TAble 1
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN HRE protestant, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result f0= -2.18
preserve
drop if year>=1400
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result f1= -1.01
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN HRE, a(ID year) vce(cluster ID)
psacalc2 delta conflicts_RA_forward_papal
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*******f2 -1.37
restore

**Early Modern
preserve
drop if year<=1450
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result f5 = 21.44
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN HRE, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********resultf7  = 17.06
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN HRE protestant, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
************** f8 . 
restore


*******OSter sensitivity tests: TAble 2
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE protestant, a(ID year) vce(cluster ID)
psacalc2 delta conflicts_RA_forward_papal
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
************ f01 -2.06
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N HRE ParliamentsN VBBCommuneN KS_primogeniture CitiesBosker5kN, a(ID year) vce(cluster ID)
psacalc2 delta conflicts_RA_forward_papal
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
************ f4 -2.66

**Early Modern
preserve
drop if year<=1450
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result f9 = 16.62
reghdfe stateN conflicts_RA_forward_papal DOdummyall150N  ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE protestant, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result f10 = . 
restore

**********Figure 5 marginal effects
*marked conflict as a discrete variable by using the i. prefix i, so Stata will know that it should calculate the marginal effect is the discrete difference between E(y | c = 1) and E(y | c = 0), rather than as d E(y)/dc (which would be correct for a continuous variable but not for a dichotomy). So ok to use dydx(PCD)

reghdfe stateN i.PCD##i.HRE DOdummyall150N, a(ID year) vce(cluster ID)
estimates store i1
margins, dydx(PCD) at(HRE=(0 1)) 
marginsplot, graphregion(fcolor(white))
graph save Graph "/Users/.../Figure5MEConflictonFragmentation.gph", replace

*******TAble 3 communes***********
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N  BishopricsN ParliamentsN CitiesBosker5kN, a(ID year) vce(cluster ID)
estimates store c0
preserve
drop if year>=1400 
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N , absorb(ID year) cluster(ID)
estimates store c1
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N BishopricsN , a(ID year) vce(cluster ID)
estimates store c2
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N  BishopricsN ParliamentsN CitiesBosker5kN , a(ID year) vce(cluster ID)
estimates store c3, title (Bf)
restore
preserve
drop if year<=1450
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N, absorb(ID year) cluster(ID)
estimates store c4
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N BishopricsN , a(ID year) vce(cluster ID)
estimates store c5
reghdfe VBBCommuneN conflicts_RA_forward_papal stateN DOdummyall150N BishopricsN ParliamentsN CitiesBosker5kN, a(ID year) vce(cluster ID)
estimates store c6, title (Bf) 
restore

esttab  c0 c1 c3 c4 c6 using Table3.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f)) noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern") title(Communes\label{tab1a}) 

*esttab  c0 c1 c3 c4 c6 using CommunesTable3.rtf, replace ar2 cells(b(star fmt(3)) se(par fmt(3))) legend varlabels( _cons constant) stats(r2_a N, fmt(%9.3fc %9.0f)) noomitted nobaselevels label nodepvars collabels(none)


******FIGURE 6 COMMUNES************
coefplot c0, drop (_cons HRE protestant) xline (0) order (conflicts_RA_forward_papal stateN DOdummyall150N )  graphregion(fcolor(white))  plotlabels ("Medieval" "Early Modern")  
graph save Graph "/Users/.../Figure6communes.gph", replace

******Communes: Oster sensitivity tests
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N BishopricsN ParliamentsN CitiesBosker5kN stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result -3.88 
preserve
drop if year>=1400
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result = -1.58
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N BishopricsN stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result = -1.79
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
************-2.0
restore
preserve
drop if year<=1450
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*******9.97
restore
preserve
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result = -2.91
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N BishopricsN stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
*********result = -2.97
reghdfe VBBCommuneN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN stateN, a(ID year) vce(cluster ID)
estimates store est1
psacalc2 delta conflicts_RA_forward_papal
scalar delta1 = r(delta)
estimates restore est1
estadd scalar delta1
restore
*********result-3.87


********APPENDIX********
******TAble A.1 Variable summary
summarize stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN CitiesBosker5kN CitiesBairochAllN VBBCommuneN KSP BishopricsN HRE protestant Rubin_prot
estpost summarize stateN conflicts_RA_forward_papal DOdummyall150N ParliamentsN VBBCommuneN KSP BishopricsN HRE protestant Rubin_prot

*******Chow tests: H0= stable coefficients (no structural break, data can be represented with one regression line). Reject H0 if calculated F value is greater than F critical value. If p large, do not reject H0.  

**fragmentation**
gen d = .
replace d = 1 if year <1400
gen x1 = d*conflicts_RA_forward_papal
gen x2 = d*DOdummyall150N
gen x3 = d*ParliamentsN
gen x4 = d*CitiesBosker5kN

reg stateN d x1 x2 , r
test d x1 x2 
reg stateN d x1 x2 x3 x4, r
test d x1 x2 x3 x4  
drop d x1 x2 x3 x4  

gen d = .
replace d = 1 if year > 1450
gen x1 = d*conflicts_RA_forward_papal
gen x2 = d*DOdummyall150N
gen x3 = d*ParliamentsN
gen x4 = d*CitiesBosker5kN

reg stateN d x1 x2 , r
test d x1 x2 
reg stateN d x1 x2 x3 x4, r
test d x1 x2 x3 x4  
drop d x1 x2 x3 x4 



*******APPENDIX TAble A.2 State level data, using alternative specificatino for fragmentation: # of borders within 100km radius of state center. 
use "/Users/.../FragmentationState.dta", clear
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share DO_commune_mean KSP ParliamentsN CitiesBairochAllN HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f2

preserve
drop if year>=1400
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share, absorb(state year) cluster(state)
estimates store f3
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share  ParliamentsN CitiesBairochAllN HRE, absorb(state year) cluster(state)
estimates store f4
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f5

restore
preserve
drop if year<=1450
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share, absorb(state year) cluster(state)
estimates store f6
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN HRE, absorb(state year) cluster(state)
estimates store f7
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f8
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE, absorb(state year) cluster(state)
estimates store f9
reghdfe frag100N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f10
restore

esttab  f2 f4 f5 f8 f10 using TableA.2.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))  noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "250km medieval" "500km medieval") title(State-level Dat: 100km radius around state centroids\label{tab1a}) 

*esttab f2 f4 f5 f8 f10 using TableA.2.rtf, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))  noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation)

********Table A.3 State level data, using alternative specificatino for fragmentation: # of borders within 250km radius of state center. 
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share DO_commune_mean KSP ParliamentsN CitiesBairochAllN HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f2

preserve
drop if year>=1400
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share, absorb(state year) cluster(state)
estimates store f3
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share  ParliamentsN CitiesBairochAllN HRE, absorb(state year) cluster(state)
estimates store f4
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE, absorb(state year) cluster(state)
estimates store f5

restore
preserve
drop if year<=1450
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share, absorb(state year) cluster(state)
estimates store f6
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN HRE, absorb(state year) cluster(state)
estimates store f7
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f8
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE, absorb(state year) cluster(state)
estimates store f9
reghdfe frag250N conflicts_RA_forward_papal DO_dummy_all150_share ParliamentsN CitiesBairochAllN DO_commune_mean KSP  HRE Rubin_prot, absorb(state year) cluster(state)
estimates store f10
restore


esttab  f2 f4 f5 f8 f10 using TableA.3.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))  noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "250km medieval" "500km medieval") title(State-level Dat: 250km radius around state centroids\label{tab1a}) 

*esttab f2 f4 f5 f8 f10 using TableA.3.rtf, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))  noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern") title(Papal Conflict Increases Territorial Fragmentation) 

******APPENDIX TABLE A.4 and A.5 PLACEBO TESTS************
use "/Users/.../FragmentationRaster.dta", clear
reghdfe stateN Fpapalconflict DOdummyall150N ParliamentsN CitiesBosker5kN HRE Rubin_prot, a(ID year) vce(cluster ID)
estimates store f0
reghdfe stateN Fpapalconflict DOdummyall150N ParliamentsN CitiesBosker5kN VBBCommuneN KSP HRE Rubin_prot, a(ID year) vce(cluster ID)
estimates store f01
preserve
drop if year>=1400
reghdfe stateN Fpapalconflict DOdummyall150N HRE, a(ID year) vce(cluster ID)
estimates store f1
reghdfe stateN Fpapalconflict DOdummyall150N HRE ParliamentsN CitiesBosker5kN, a(ID year) vce(cluster ID)
estimates store f2
reghdfe stateN Fpapalconflict DOdummyall150N HRE VBBCommuneN ParliamentsN CitiesBosker5kN, a(ID year) vce(cluster ID)
estimates store f3
reghdfe stateN Fpapalconflict DOdummyall150N HRE ParliamentsN VBBCommuneN KSP CitiesBosker5kN, a(ID year) vce(cluster ID)
estimates store f4
restore
preserve
drop if year<=1450
reghdfe stateN Fpapalconflict DOdummyall150N HRE , a(ID year) vce(cluster ID)
estimates store f5
reghdfe stateN Fpapalconflict DOdummyall150N HRE Rubin_prot, a(ID year) vce(cluster ID)
estimates store f6
reghdfe stateN Fpapalconflict DOdummyall150N HRE ParliamentsN CitiesBosker5kN Rubin_prot, a(ID year) vce(cluster ID)
estimates store f7
reghdfe stateN Fpapalconflict DOdummyall150N HRE ParliamentsN CitiesBosker5kN Rubin_prot, a(ID year) vce(cluster ID)
estimates store f8
reghdfe stateN Fpapalconflict DOdummyall150N HRE VBBCommuneN KSP ParliamentsN CitiesBosker5kN KSP, a(ID year) vce(cluster ID)
estimates store f9
reghdfe stateN Fpapalconflict DOdummyall150N HRE VBBCommuneN ParliamentsN CitiesBosker5kN KSP Rubin_prot, a(ID year) vce(cluster ID)
estimates store f10
restore

esttab f0 f1 f2 f5 f7 f8 using TableA.4.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern" "Early Modern" "Early Modern") title(Placebo Tests\label{tab1a}) 

esttab f01 f4 f9 f10 using TableA.5.tex, replace se cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern" "Early Modern") title(Placebo Tests: alternative explanations\label{tab1a}) 


******APPENDIX TABLE A.6: Communes Placebo tests 
 reghdfe VBBCommuneN Fpapalconflict stateN DOdummyall150N BishopricsN ParliamentsN CitiesBosker5kN , a(ID year) vce(cluster ID)
 estimates store c0
 preserve
drop if year>=1400 
reghdfe VBBCommuneN Fpapalconflict stateN DOdummyall150N, absorb(ID year) cluster(ID)
estimates store c1
reghdfe VBBCommuneN Fpapalconflict stateN DOdummyall150N BishopricsN ParliamentsN CitiesBosker5kN stateN, a(ID year) vce(cluster ID)
estimates store c3, title (Bf)
restore
preserve
drop if year<=1450
reghdfe VBBCommuneN Fpapalconflict stateN DOdummyall150N, absorb(ID year) cluster(ID)
estimates store c4
reghdfe VBBCommuneN Fpapalconflict stateN DOdummyall150N BishopricsN ParliamentsN CitiesBosker5kN stateN, a(ID year) vce(cluster ID)
estimates store c6, title (Bf) 
restore

esttab  c0 c1 c3 c4 c6 using TableA.6.tex, replace se cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) star(* 0.05 ** 0.01 *** 0.001) stats(r2_a N, fmt(%9.3fc %9.0f))noomitted nobaselevels label nodepvars collabels(none) legend mtitle("All" "Medieval" "Medieval" "Early Modern" "Early Modern") title(Communes Placebo Tests\label{tab1a}) 


******* Appendix Figure A.1: parallel trends, using 1200 as cutoff for papal treatment 
preserve
keep if conflicts_RA_forward_papal>=3 | conflicts_RA_forward_papal==0
gen PCD2=.
replace PCD2=1 if conflicts_RA_forward_papal>=1 
replace PCD2=0 if conflicts_RA_forward_papal==0
collapse (mean) stateN, by(PCD2 century)
reshape wide stateN, i(century) j(PCD2)
graph twoway connect stateN* century if century <14, graphregion(fcolor(white))
restore
graph save Graph "/Users/.../Parallel trends until 13th c.gph", replace

******Appendix Table A.7 Mediation analysis:how is effect of church conflict mediated by primogeniture?
 preserve 
drop if year>=1400
medeff(regress KS_primogeniture conflicts_RA_forward_papal ParliamentsN CitiesBosker5kN) (regress stateN conflicts_RA_forward_papal KS_primogeniture ParliamentsN CitiesBosker5kN), treat(conflicts_RA_forward_papal) mediate(KS_primogeniture) sims (1000)
estimates store f1
restore
preserve
drop if year<=1400
medeff(regress KS_primogeniture conflicts_RA_forward_papal ParliamentsN CitiesBosker5kN) (regress stateN conflicts_RA_forward_papal KS_primogeniture ParliamentsN CitiesBosker5kN), treat(conflicts_RA_forward_papal) mediate(KS_primogeniture) sims (1000)
estimates store f2
restore
*******]how is effect of church conflict mediated by communes?
preserve 
drop if year>=1400
medeff(regress VBBCommuneN conflicts_RA_forward_papal ParliamentsN CitiesBosker5kN) (regress stateN conflicts_RA_forward_papal VBBCommuneN ParliamentsN CitiesBosker5kN), treat(conflicts_RA_forward_papal) mediate(VBBCommuneN) sims (1000)
estimates store f3
restore
preserve
drop if year<=1400
medeff(regress VBBCommuneN conflicts_RA_forward_papal ParliamentsN CitiesBosker5kN) (regress stateN conflicts_RA_forward_papal VBBCommuneN ParliamentsN CitiesBosker5kN), treat(conflicts_RA_forward_papal) mediate(VBBCommuneN) sims (1000)
estimates store f4
restore

*constructed table A.7 by hand from output. Compared ACME, DE, TE, and % TE mediated
